<?php

define("__CALL__", true);
require_once dirname(__FILE__) . '/header.php';
require_once dirname(__FILE__) . '/inc/session.php';
require_once dirname(__FILE__) . '/inc/cms_q_header.php';

if (!isset($_GET['file']))
    exit("No call defined");

$f = __ADMIN_DIR__ . "/" . $_GET['file'];

if (isset($_SESSION['WideUserObject']))
{
    if (file_exists($f))
    {
        switch ($_GET['type'])
        {
            case "print":
                if ($_SESSION['user']['permissions']['id'] != "guest")
                    print file_get_contents($f);
                else
                    exit("Need admin status to print out files.");
                break;
            default: //parse script by including it in code
                include $f;
                break;
        }
    }
    else
    {
        exit("File: '{$f}' does not exist");
    }
}
else
    print "u need 2 be adminz";
?>